/* ============================================
   SCHOLARION CALENDAR - COMPREHENSIVE STYLES
   ============================================
   
   Modern calendar system with:
   - CSS Custom Properties for easy theming
   - Font Awesome icon integration
   - Badge-style components
   - Responsive design
   - Dark mode support
   - High contrast mode support
   
   Version: 3.0 (Refactored & Optimized)
   Last Updated: 2025
   
   TABLE OF CONTENTS:
   1. CSS Variables & Theme Configuration
   2. Base & Reset Styles
   3. Calendar Structure (Container, Header, Body)
   4. Calendar Navigation
   5. Calendar Day Cells
   6. Attendance Badges
   7. Class/Timetable Data Cells
   8. Event Lists
   9. OOB Entity List Calendar
   10. Year View Layout
   11. Weekend & Weekday Styling
   12. Calendar Spacing Adjustments
   13. Theme Variations (Dark Mode, High Contrast)
   14. Responsive Design
   15. Accessibility
   16. Print Styles
   ============================================ */

/* ============================================
   1. CSS VARIABLES & THEME CONFIGURATION
   ============================================ */
:root {
  /* === COLORS - PRIMARY === */
  --calendar-primary: #1a4a4a;
  --scholarion-primary: #1a4a4a; /* Alias for compatibility */
  --calendar-secondary: #2d8a8a;
  --calendar-accent: #d97706;
  --scholarion-accent: #d97706; /* Alias for compatibility */

  /* === COLORS - SEMANTIC === */
  --calendar-success: #059669;
  --calendar-warning: #f59e0b;
  --calendar-danger: #d83b01;
  --calendar-info: #f2c811;
  --calendar-info-light: #d9edf7;

  /* === COLORS - SURFACE === */
  --calendar-surface: #ffffff;
  --calendar-bg: #f8f9fa;
  --scholarion-bg: #f8f9fa; /* Alias for compatibility */
  --calendar-fg: #afe0d0;
  --calendar-border: #e9ecef;
  --scholarion-border: #e9ecef; /* Alias for compatibility */

  /* === COLORS - TEXT === */
  --calendar-text: #1f2937;
  --scholarion-text: #1f2937; /* Alias for compatibility */
  --calendar-text-muted: #6b7280;

  /* === SHADOWS === */
  --calendar-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.01);
  --calendar-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);

  /* === TYPOGRAPHY === */
  --calendar-font-primary: "Poppins", system-ui, sans-serif;
  --calendar-font-secondary: Arial, Helvetica, sans-serif;

  /* === FONT AWESOME ICONS === */
  --icon-present: "\f058"; /* fa-check-circle */
  --icon-absent: "\f057"; /* fa-times-circle */
  --icon-late: "\f017"; /* fa-clock */
  --icon-excused: "\f05a"; /* fa-info-circle */
  --icon-unexcused: "\f06a"; /* fa-exclamation-circle */
  --icon-class: "\f51c"; /* fa-chalkboard-user */

  /* === SPACING === */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* === BORDER RADIUS === */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 50%;
}

/* ============================================
   DARK MODE VARIABLES
   ============================================ */
html[data-theme="dark"] {
  --calendar-surface: #586574;
  --calendar-bg: #586574;
  --calendar-border: #1f2937;
  --calendar-text: #e5e7eb;
  --calendar-text-muted: #9aa4b2;
  --calendar-primary: #013530;
  --calendar-secondary: #94a3b8;
  --calendar-accent: #34d399;
}

/* ============================================
   HIGH CONTRAST MODE VARIABLES
   ============================================ */
html[data-theme="high-contrast"] {
  /* === HIGH CONTRAST COLORS === */
  --calendar-primary: #004c45;
  --calendar-secondary: #2d8a8a;
  --calendar-accent: #d97706;

  /* === SEMANTIC COLORS - ENHANCED === */
  --calendar-success: #008000;
  --calendar-warning: #ff6600;
  --calendar-danger: #cc0000;
  --calendar-info: #cc9900;
  --calendar-info-light: #ffffcc;

  /* === SURFACE COLORS === */
  --calendar-surface: #ffffff;
  --calendar-bg: #ffffff;
  --calendar-border: #000000;

  /* === TEXTCOLORS === */
  --calendar-text: #000000;
  --calendar-text-muted: #333333;

  /* === HEADER === */
  --calendar-fg: #cce5ff;

  /* === ENHANCED SHADOWS === */
  --calendar-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --calendar-shadow-md: 0px 2px 6px rgba(0, 0, 0, 0.4), 0px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ============================================
   2. BASE & RESET STYLES
   ============================================ */
body {
  font-family: var(--calendar-font-primary);
  color: var(--calendar-text);
}

.label {
  font-size: 14px;
  color: var(--calendar-text-muted);
  font-weight: 600;
  font-family: var(--calendar-font-secondary);
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 5px;
}

.input-type {
  font-size: 14px;
  color: var(--calendar-text);
  font-weight: 400;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6px 0;
  width: 100%;
  word-break: break-all;
}

.cell-padding {
  padding: 0 28px 1px;
}

.div-container {
  margin-right: auto;
  margin-left: auto;
  padding-left: 15px;
  padding-right: 15px;
}

.table-details {
  table-layout: fixed;
  width: 100%;
}

.course-name {
  width: 100%;
  word-break: break-all;
}

/* ============================================
   3. CALENDAR STRUCTURE
   ============================================ */

/* === Calendar Container === */
#calendar,
.calendar {
  background: var(--calendar-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--calendar-shadow-sm);
  overflow: hidden;
}

/* Default calendar container styles */
#calendar {
  font-family: var(--calendar-font-primary);
  padding: var(--spacing-lg);
  color: var(--calendar-text);
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
  border: 1px solid var(--calendar-border);
}

/* Specific styling for the .calendar class */
.calendar {
  padding: 20px 50px;
  border: 2px solid var(--calendar-border);
  box-shadow: var(--calendar-shadow-md);
  margin: 0 auto;
  border-radius: var(--radius-xl); /* needed for OOB Calendar */
}

/* High contrast calendar container with bolder borders */
html[data-theme="high-contrast"] #calendar,
html[data-theme="high-contrast"] .calendar {
  border-width: 3px;
  border-color: var(--calendar-border);
}

/* === Calendar Header === */
.calendar__month {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1.75rem;
  padding: var(--spacing-xl) 0 var(--spacing-sm) 0;
  position: relative;
  color: var(--calendar-primary);
  border-bottom: 2px solid var(--calendar-border);
}

#calendar .calendar__month {
  padding: 0.75rem var(--spacing-md);
  background: var(--calendar-surface);
  border: 1px solid var(--calendar-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--calendar-shadow-sm);
  gap: var(--spacing-md);
}

.cal-month__current {
  flex: 1;
  text-align: center;
  color: var(--calendar-primary);
  font-weight: 600;
}

/* High contrast month header with bolder text */
html[data-theme="high-contrast"] .calendar__month {
  font-weight: 700;
  border-bottom-width: 3px;
}

html[data-theme="high-contrast"] #calendar .calendar__month {
  border-width: 2px;
}

/* === Calendar Head (Day Names) === */
.calendar__head {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  width: 100%;
  line-height: 50px;
  position: relative;
  font-weight: 600;
  /* border-top: 1px solid var(--calendar-border); */
  border-bottom: 1px solid var(--calendar-border);
  /* padding-top: var(--spacing-md);
  padding-bottom: var(--spacing-sm); */
}

#calendar .calendar__head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  text-transform: uppercase;
  color: var(--calendar-text-muted);
}

.cal-head__day {
  display: inline-block;
  text-align: center;
  color: var(--calendar-text-muted);
  width: 13.5%;
  /* background: color-mix(in oklab, var(--calendar-surface) 90%, var(--calendar-border) 10%); */
  font-weight: 600;
  font-size: 0.85rem;
  /* padding: var(--spacing-sm) 0; */
  /* border-bottom: 1px solid var(--calendar-border); */
  min-width: 140px;
}

/* High contrast calendar head with bolder text and borders */
html[data-theme="high-contrast"] .calendar__head {
  border-top-width: 2px;
  border-bottom-width: 2px;
  font-weight: 700;
}

html[data-theme="high-contrast"] .cal-head__day {
  font-weight: 700;
  border-bottom-width: 2px;
  color: var(--calendar-text);
}

/* === Calendar Body === */
.calendar__body {
  display: grid;
  grid-template-rows: repeat(5, auto);
  margin-top: var(--spacing-sm);
}

.cal-body__week {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  min-height: 120px;
}

#calendar .cal-body__week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--spacing-sm);
}

/* ============================================
   4. CALENDAR NAVIGATION
   ============================================ */

/* === Navigation Buttons === */
.cal-month__previous,
.cal-month__next {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius-full);
  background: var(--calendar-primary);
  color: #ffffff;
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: var(--calendar-shadow-sm);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

#calendar .cal-month__previous,
#calendar .cal-month__next {
  position: relative;
  top: auto;
  transform: none;
}

.cal-month__previous:hover,
.cal-month__next:hover {
  background: var(--calendar-secondary);
  box-shadow: var(--calendar-shadow-md);
  transform: scale(1.08);
  font-weight: 800;
  color: #111;
}

.cal-month__previous:focus-visible,
.cal-month__next:focus-visible {
  outline: 2px solid var(--calendar-accent);
  outline-offset: 2px;
}

.cal-month__next {
  right: 0;
}

.cal-month__previous i,
.cal-month__next i {
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
}

/* High contrast navigation buttons with bolder borders and enhanced focus */
html[data-theme="high-contrast"] .cal-month__previous,
html[data-theme="high-contrast"] .cal-month__next {
  border: 2px solid var(--calendar-border);
  font-weight: 700;
}

html[data-theme="high-contrast"] .cal-month__previous:focus-visible,
html[data-theme="high-contrast"] .cal-month__next:focus-visible {
  outline-width: 3px;
  outline-offset: 3px;
}

/* ============================================
   5. CALENDAR DAY CELLS
   ============================================ */

/* === Day Cell Base Styles === */
.cal-body__day,
.cal-month-day {
  position: relative;
  display: block;
  width: 100%;
  min-height: 120px;
  background: var(--calendar-surface);
  border: 1px solid var(--calendar-border);
  transition: all 0.2s ease;
}

/* Styles specific to #calendar or .calendar contexts */
#calendar .cal-body__day {
  min-width: 140px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: default;
}

/* Hover effect for day cells */
.cal-body__day:hover {
  background: var(--calendar-surface);
  transform: scale(1.02);
  box-shadow: var(--calendar-shadow-sm);
  z-index: 1;
}

/* High contrast day cells with bolder borders */
html[data-theme="high-contrast"] .cal-body__day {
  border-width: 2px;
  font-weight: 600;
}

/* === CURRENT MONTH DAYS === */
.cal-day__month--current {
  color: var(--calendar-text);
}

/* === OUT-OF-MONTH DAYS === */
.cal-day__month--previous,
.cal-day__month--next {
  color: var(--calendar-text-muted);
  background: color-mix(in oklab, var(--calendar-bg) 96%, var(--calendar-text-muted) 6%);
  opacity: 0.85;
}

html[data-theme="dark"] .cal-day__month--previous,
html[data-theme="dark"] .cal-day__month--next {
  background: color-mix(in oklab, var(--calendar-surface) 92%, var(--calendar-text-muted) 8%);
  opacity: 0.8;
}

/* High contrast out-of-month days with strikethrough pattern */
html[data-theme="high-contrast"] .cal-day__month--previous,
html[data-theme="high-contrast"] .cal-day__month--next {
  background: repeating-linear-gradient(45deg, var(--calendar-bg), var(--calendar-bg) 10px, #f0f0f0 10px, #f0f0f0 20px);
  opacity: 0.7;
}

/* === TODAY HIGHLIGHT === */
.cal-day__day--today,
.cal-day__day--today.cal-day__month--current {
  font-weight: 800;
  color: var(--calendar-primary);
  border: 2px solid var(--calendar-accent);
  background: color-mix(in oklab, var(--calendar-accent) 12%, white);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--calendar-accent) 25%, transparent);
  position: relative;
  z-index: 2;
}

.cal-day__day--today:hover {
  transform: scale(1.03);
  background: color-mix(in oklab, var(--calendar-accent) 20%, white);
}

.cal-day__day--today > .event-list {
  background: rgba(0, 54, 121, 0.1);
}

/* High contrast today highlight with bold border and enhanced shadow */
html[data-theme="high-contrast"] .cal-day__day--today,
html[data-theme="high-contrast"] .cal-day__day--today.cal-day__month--current {
  border-width: 4px;
  font-weight: 900;
  box-shadow: 0 0 0 4px var(--calendar-accent);
}

/* === SELECTED DAY === */
.cal-day__day--selected {
  background-color: initial;
  box-shadow: var(--calendar-shadow-sm);
  border-radius: var(--radius-full);
  color: #111;
}

/* === WEEKENDS === */
html[data-theme="dark"] .cal-body__day.weekend {
  background: color-mix(in oklab, var(--calendar-surface) 90%, var(--calendar-text-muted) 10%);
}

.cal-day__month--previous.weekend,
.cal-day__month--next.weekend {
  opacity: 0.85;
}

/* ============================================
   6. ATTENDANCE BADGES
   ============================================ */

/* === Base Badge Styles === */
.badge-present,
.badge-absent,
.badge-late,
.badge-tardy,
.badge-excused,
.badge-unexcused {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  transition: all 0.2s ease;
  margin: var(--spacing-xs) 0;
  width: fit-content;
  box-shadow: var(--calendar-shadow-sm);
}

.badge-present:hover,
.badge-absent:hover,
.badge-late:hover,
.badge-tardy:hover,
.badge-excused:hover,
.badge-unexcused:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* High contrast badges with bolder borders and font weight */
html[data-theme="high-contrast"] .badge-present,
html[data-theme="high-contrast"] .badge-absent,
html[data-theme="high-contrast"] .badge-late,
html[data-theme="high-contrast"] .badge-tardy,
html[data-theme="high-contrast"] .badge-excused,
html[data-theme="high-contrast"] .badge-unexcused {
  border-width: 2px;
  font-weight: 700;
  box-shadow: var(--calendar-shadow-md);
}

/* === Badge Icons (Font Awesome) === */
.badge-present::before,
.badge-absent::before,
.badge-late::before,
.badge-tardy::before,
.badge-excused::before,
.badge-unexcused::before {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Badge Text Labels === */
.badge-present::after {
  content: "Present";
}

.badge-absent::after {
  content: "Absent";
}

.badge-late::after {
  content: "Late";
}

.badge-tardy::after {
  content: "Tardy";
}

.badge-excused::after {
  content: "Excused";
}

.badge-unexcused::after {
  content: "Unexcused";
}

/* === PRESENT BADGE === */
.badge-present {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-present::before {
  content: var(--icon-present);
  color: #059669;
}

/* === ABSENT BADGE === */
.badge-absent {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-absent::before {
  content: var(--icon-absent);
  color: #dc2626;
}

/* === LATE/TARDY BADGE === */
.badge-late,
.badge-tardy {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-late::before,
.badge-tardy::before {
  content: var(--icon-late);
  color: #f59e0b;
}

/* === EXCUSED BADGE === */
.badge-excused {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-excused::before {
  content: var(--icon-excused);
  color: #3b82f6;
}

/* === UNEXCUSED BADGE === */
.badge-unexcused {
  background-color: #fce4ec;
  color: #ad1457;
  border: 1px solid #f48fb1;
}

.badge-unexcused::before {
  content: var(--icon-unexcused);
  color: #ad1457;
}

/* High contrast attendance status with bolder borders */
html[data-theme="high-contrast"] .event-present,
html[data-theme="high-contrast"] .cal-day__day--present,
html[data-theme="high-contrast"] .cal-day__day--tardy,
html[data-theme="high-contrast"] .cal-day__day--excused,
html[data-theme="high-contrast"] .cal-day__day--unexcused {
  border: 3px solid var(--calendar-border);
  font-weight: 700;
}

/* ============================================
   7. CLASS/TIMETABLE DATA CELLS
   ============================================ */

/* === Data Cell Base Styles === */
.dataCell,
.moreDataCell {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.25;
  transition: all 0.2s ease;
  min-width: 110px;
  width: 110px;
  background-color: var(--calendar-fg);
  color: var(--calendar-text);
  border: 1px solid color-mix(in oklab, var(--calendar-fg) 80%, var(--calendar-border) 20%);
  box-shadow: var(--calendar-shadow-sm);
  height: auto;
  min-height: 28px;
  overflow: visible;
  text-align: left;
  cursor: pointer;
}

.dataCell::before,
.moreDataCell::before {
  content: var(--icon-class);
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  font-size: 0.75rem;
  line-height: 1;
  display: inline-block;
  flex-shrink: 0;
  color: var(--calendar-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dataCell:hover,
.moreDataCell:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  background-color: color-mix(in oklab, var(--calendar-accent) 90%, var(--calendar-primary) 10%);
}

.dataCell:focus,
.moreDataCell:focus {
  outline: 2px solid var(--calendar-accent);
  outline-offset: 2px;
}

.moreDataCell {
  background-color: var(--calendar-accent);
  color: #ffffff;
}

.moreDataCell::before {
  content: "\f078"; /* fa-chevron-down */
  color: #ffffff;
}

.moreDataCell:hover::before {
  color: #ffffff;
}

/* Dark Mode - Data Cells */
html[data-theme="dark"] .dataCell,
html[data-theme="dark"] .moreDataCell {
  background-color: var(--calendar-fg);
  color: var(--calendar-text);
  border-color: color-mix(in oklab, var(--calendar-fg) 70%, var(--calendar-border) 30%);
}

html[data-theme="dark"] .dataCell::before,
html[data-theme="dark"] .moreDataCell::before {
  color: var(--calendar-secondary);
}

/* High Contrast - Data Cells */
html[data-theme="high-contrast"] .dataCell,
html[data-theme="high-contrast"] .moreDataCell {
  border-width: 2px;
  border-color: #000000;
  font-weight: 700;
  box-shadow: var(--calendar-shadow-md);
}

html[data-theme="high-contrast"] .dataCell::before,
html[data-theme="high-contrast"] .moreDataCell::before {
  color: var(--calendar-primary);
  font-weight: 900;
}

html[data-theme="high-contrast"] .dataCell:focus,
html[data-theme="high-contrast"] .moreDataCell:focus {
  outline-width: 3px;
  outline-offset: 3px;
}

/* ============================================
   8. EVENT LIST CONTAINER
   ============================================ */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  /* Tighter gap for better vertical alignment */
  padding: var(--spacing-sm);
  align-items: flex-start;
  width: 100%;
}

.event-info {
  background-color: unset !important;
}

/* ============================================
   SCHOOL CALENDAR SPECIFIC STYLES
   ============================================ */
.switchViewStyle {
  color: var(--calendar-primary);
  display: flex;
  align-content: stretch;
  justify-content: flex-end;
}

.switchViewStyle p {
  padding-left: 8px;
  color: var(--calendar-text);
}

.switchViewStyle img {
  width: 20px;
  height: 20px;
}

.calendarButton {
  background-color: transparent;
  border: none;
  color: var(--calendar-text);
}

/* ============================================
   LEGEND
   ============================================ */
.divTable {
  display: none;
  margin-top: 1.2rem;
  background: var(--calendar-surface);
  border-radius: 10px;
  padding: 0.75rem var(--spacing-md);
  box-shadow: var(--calendar-shadow-sm);
}

.divTable .key {
  font-weight: 600;
  color: var(--calendar-text-muted);
  margin-bottom: var(--spacing-xs);
  width: 23px;
  height: 19px;
  font-family: var(--calendar-font-secondary);
  font-size: 14px;
  line-height: 16px;
  display: flex;
  align-items: center;
  text-align: center;
  padding-left: 8px;
}

.divRow {
  display: table-row;
}

.divCell {
  padding-left: 8px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-md);
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.85rem;
  color: var(--calendar-text-muted);
}

.calendar-legend-item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.calendar-legend-item.holiday::before {
  background: var(--calendar-danger);
}

.calendar-legend-item.school-event::before {
  background: var(--calendar-secondary);
}

.calendar-legend-item.exam::before {
  background: var(--calendar-warning);
}

.calendar-legend-item.sport::before {
  background: var(--calendar-success);
}

.calendar-legend-item.term-date::before {
  background: var(--calendar-accent);
}

html[data-theme="high-contrast"] .calendar-legend-item::before {
  border: 2px solid var(--calendar-border);
  width: 14px;
  height: 14px;
}

html[data-theme="high-contrast"] .calendar-legend-item {
  font-weight: 600;
  color: var(--calendar-text);
}

/* ============================================
   MOBILE EVENTS
   ============================================ */
.mobileEvents {
  display: none;
}

#mobileEventDiv {
  display: none;
  color: var(--calendar-text);
}

.day-label {
  float: left !important;
  margin-bottom: unset;
}

/* ============================================
   CALENDAR LAYOUT CENTERING
   ============================================ */
#attendanceViewCalendarControl,
#calendarControl {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: var(--spacing-md);
}

#main-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

#main-row > div[role="main"] {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================================
   DARK MODE
   ============================================ */
html[data-theme="dark"] #calendar {
  background: var(--calendar-surface);
  color: var(--calendar-text);
  border-color: var(--calendar-border);
}

html[data-theme="dark"] .cal-body__day {
  background: color-mix(in oklab, var(--calendar-surface) 90%, black);
  border-color: var(--calendar-border);
}

/* Dark Mode - Badges */
html[data-theme="dark"] .badge-present {
  background-color: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.3);
}

html[data-theme="dark"] .badge-present::before {
  color: #10b981;
}

html[data-theme="dark"] .badge-absent {
  background-color: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.3);
}

html[data-theme="dark"] .badge-absent::before {
  color: #ef4444;
}

html[data-theme="dark"] .badge-late,
html[data-theme="dark"] .badge-tardy {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.3);
}

html[data-theme="dark"] .badge-late::before,
html[data-theme="dark"] .badge-tardy::before {
  color: #fbbf24;
}

html[data-theme="dark"] .badge-excused {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.3);
}

html[data-theme="dark"] .badge-excused::before {
  color: #60a5fa;
}

html[data-theme="dark"] .badge-unexcused {
  background-color: rgba(173, 20, 87, 0.2);
  color: #f06292;
  border-color: rgba(240, 98, 146, 0.3);
}

html[data-theme="dark"] .badge-unexcused::before {
  color: #f06292;
}

/* ============================================
   14. RESPONSIVE DESIGN
   ============================================ */

/* === TABLET === */
@media (max-width: 1024px) {
  .cell-padding {
    padding: 0 12px 8px;
  }

  .div-container {
    overflow-x: scroll;
  }

  .divTable {
    display: block;
    padding-bottom: 10px;
    color: var(--calendar-text);
  }

  .calendar__month {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 20px;
    font-weight: normal;
    padding: var(--spacing-xl) 0;
  }

  .calendar {
    width: 100%;
    box-shadow: none;
    max-width: 100%;
  }

  .calendar__head,
  .cal-body__week {
    width: 100%;
    height: 64px;
  }

  #calendar .calendar__head,
  #calendar .cal-body__week {
    margin-left: 10px;
  }

  .cal-head__day,
  .cal-body__day {
    width: 13.5%;
    height: 64px;
    line-height: 20px;
  }

  .cal-body__day {
    display: flex !important;
    flex-direction: column;
    align-items: center;
  }

  .cal-body__week_sc {
    height: 60px !important;
  }

  .day-label {
    float: none !important;
    height: 36px;
    border-radius: 18px;
    width: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--calendar-text);
  }

  .day-selected {
    background-color: var(--calendar-primary) !important;
    color: white;
    border: 1px solid;
  }

  .cal-day__day--today {
    font-weight: 400 !important;
    color: var(--calendar-text) !important;
    background: var(--calendar-info-light);
  }

  .cal-day__day--today p {
    background-color: var(--calendar-info-light);
  }

  .cal-day__day--today > .event-list {
    background: var(--calendar-primary) !important;
  }

  .key {
    font-weight: 600;
    color: var(--calendar-text);
  }

  .dataCell,
  .moreDataCell {
    display: none;
  }

  .mobileEvents {
    display: block;
    border-radius: var(--radius-full);
    height: 2rem;
    width: 2rem;
    background-color: #605e5c;
  }

  #mobileEventDiv {
    display: block;
    color: var(--calendar-text);
  }

  .events-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 4px;
    gap: 5px;
    box-shadow: var(--calendar-shadow-sm);
    border: 1px solid var(--calendar-border);
    border-radius: var(--radius-md);
    background: var(--calendar-surface);
    margin-bottom: 8px;
    padding-left: 12px;
  }

  .events-tile {
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    letter-spacing: -0.408px;
    color: var(--calendar-text);
  }

  .events-timings {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 18px;
    margin-bottom: 10px;
  }

  .events-date {
    font-weight: 400;
    line-height: 22px;
    letter-spacing: -0.408px;
    margin-bottom: 15px;
    margin-top: 10px;
  }

  .events-day {
    font-weight: 400;
    line-height: 22px;
    letter-spacing: -0.408px;
    margin-bottom: 10px;
  }

  .calendar-legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .badge-present,
  .badge-absent,
  .badge-late,
  .badge-tardy,
  .badge-excused,
  .badge-unexcused {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    gap: 0.375rem;
  }

  .badge-present::before,
  .badge-absent::before,
  .badge-late::before,
  .badge-tardy::before,
  .badge-excused::before,
  .badge-unexcused::before {
    font-size: 0.875rem;
  }

  .event-list {
    padding: var(--spacing-xs);
    gap: 0.125rem;
  }

  #attendanceViewCalendarControl,
  #calendarControl {
    padding: var(--spacing-sm);
  }
}

/* === MOBILE === */
@media (max-width: 768px) {
  .badge-present,
  .badge-absent,
  .badge-late,
  .badge-tardy,
  .badge-excused,
  .badge-unexcused {
    padding: 0.375rem;
    min-width: 2rem;
    min-height: 2rem;
    justify-content: center;
    font-size: 0;
  }

  .badge-present::before,
  .badge-absent::before,
  .badge-late::before,
  .badge-tardy::before,
  .badge-excused::before,
  .badge-unexcused::before {
    font-size: 1rem;
    margin: 0;
  }

  .badge-present::after,
  .badge-absent::after,
  .badge-late::after,
  .badge-tardy::after,
  .badge-excused::after,
  .badge-unexcused::after {
    display: none;
  }

  #attendanceViewCalendarControl,
  #calendarControl {
    padding: var(--spacing-xs);
  }
}

@media (min-width: 200px) and (max-width: 1024px) {
  .cal-day__day--today > .event-list {
    background: transparent !important;
  }
}

/* ============================================
   15. ACCESSIBILITY
   ============================================ */
.badge-present:focus,
.badge-absent:focus,
.badge-late:focus,
.badge-tardy:focus,
.badge-excused:focus,
.badge-unexcused:focus {
  outline: 2px solid var(--calendar-accent);
  outline-offset: 2px;
}

html[data-theme="high-contrast"] .badge-present:focus,
html[data-theme="high-contrast"] .badge-absent:focus,
html[data-theme="high-contrast"] .badge-late:focus,
html[data-theme="high-contrast"] .badge-tardy:focus,
html[data-theme="high-contrast"] .badge-excused:focus,
html[data-theme="high-contrast"] .badge-unexcused:focus,
html[data-theme="high-contrast"] .cal-body__day:focus {
  outline-width: 3px;
  outline-offset: 3px;
  outline-color: var(--calendar-primary);
}

/* ============================================
   16. PRINT STYLES
   ============================================ */
@media print {
  .badge-present,
  .badge-absent,
  .badge-late,
  .badge-tardy,
  .badge-excused,
  .badge-unexcused,
  .dataCell,
  .moreDataCell {
    box-shadow: none;
    border: 1px solid currentColor;
  }
}

/* ============================================
   MODAL CLOSE BUTTON
   ============================================ */
#calendarModal .modal-header {
  position: relative;
}

#calendarModal .btn-close {
  width: 36px;
  height: 36px;
  padding: 0;
  position: absolute;
  right: 12px;
  top: 12px;
  border: 1px solid var(--calendar-border);
  border-radius: 9999px;
  background-color: var(--calendar-surface);
  box-shadow: var(--calendar-shadow-sm);
  opacity: 1;
  filter: none;
  background-image: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

#calendarModal .btn-close::before {
  content: "\f00d";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  font-size: 14px;
  color: var(--calendar-primary);
  line-height: 1;
}

#calendarModal .btn-close:hover {
  background-color: color-mix(in oklab, var(--calendar-primary) 10%, var(--calendar-surface));
  border-color: var(--calendar-primary);
}

#calendarModal .btn-close:hover::before {
  color: var(--calendar-primary);
}

#calendarModal .btn-close:active {
  background-color: color-mix(in oklab, var(--calendar-primary) 20%, var(--calendar-surface));
  border-color: var(--calendar-primary);
}

#calendarModal .btn-close:focus {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(26, 74, 74, 0.3), var(--calendar-shadow-sm);
}

#calendarModal .btn-close.btn-close-white {
  filter: none !important;
  background-image: none !important;
  opacity: 1 !important;
}

#calendarModal .btn-close.btn-close-white::before {
  color: var(--calendar-primary);
}

/* ============================================
   MODAL TITLE
   ============================================ */
#calendarModal .modal-title {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--calendar-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding-right: 3rem;
}

#calendarModal .modal-title i {
  color: var(--calendar-secondary);
  font-size: 1.5rem;
  line-height: 1;
}

#calendarModal .modal-header {
  background-color: color-mix(in oklab, var(--calendar-fg) 20%, var(--calendar-surface));
  border-bottom: 2px solid var(--calendar-secondary);
  padding: 1.25rem 1.5rem;
}

@media (prefers-color-scheme: dark) {
  #calendarModal .modal-title {
    color: var(--calendar-fg);
  }

  #calendarModal .modal-title i {
    color: var(--calendar-secondary);
  }

  #calendarModal .modal-header {
    background-color: color-mix(in oklab, var(--calendar-surface) 80%, black);
    border-bottom-color: var(--calendar-secondary);
  }
}

[data-theme="high-contrast"] #calendarModal .modal-title {
  font-weight: 700;
  color: #000;
}

[data-theme="high-contrast"] #calendarModal .modal-title i {
  color: var(--calendar-secondary);
  font-weight: 900;
}

[data-theme="high-contrast"] #calendarModal .modal-header {
  border-bottom-width: 3px;
  background-color: #f0f0f0;
}

/* ========================================
   REDUCED SPACING FOR ATTENDANCE/TIMETABLE CALENDARS
   ======================================== */

/* Reduce gap between days in the week row */
#calendar .cal-body__week {
  gap: 2px !important; /* Reduced from var(--spacing-sm) which is 0.5rem/8px */
}

/* Reduce margin on individual day cells */
.cal-body__day {
  margin: 1px !important; /* Reduced from 0.2rem (3.2px) */
}

/* For tighter spacing, you can also reduce the gap in the calendar head */
#calendar .calendar__head {
  gap: 2px !important;
}

/* Optional: If you want even tighter spacing, uncomment these lines */

#calendar .cal-body__week {
  gap: 0 !important;
}

.cal-body__day {
  margin: 0 !important;
}

/* Ensure the reduced spacing works well on mobile */
@media (max-width: 1024px) {
  #calendar .cal-body__week {
    gap: 1px !important;
  }

  .cal-body__day {
    margin: 0.5px !important;
  }
}
/* ========================================
   Remove Horizontal Gaps Between Days
   ======================================== */

/* Remove margins from day cells completely */
.cal-body__day,
.cal-month-day {
  margin: 0 !important;
}

/* Remove gap from week rows */
#calendar .cal-body__week,
.calendar__body .cal-body__week {
  gap: 0 !important;
  column-gap: 0 !important;
  row-gap: 0 !important;
}

/* If using grid layout, remove grid gaps */
.calendar__body {
  gap: 0 !important;
  grid-gap: 0 !important;
}

/* Ensure day cells take full width without spacing */
.cal-body__day,
.cal-month-day {
  width: 100% !important;
  flex: 1 1 0% !important;
}

/* Remove any padding that might create visual gaps */
.cal-body__week {
  padding: 0 !important;
}

/* For tighter appearance, you can also reduce border radius */
.cal-body__day,
.cal-month-day {
  border-radius: 0 !important; /* Makes cells rectangular and flush */
}

/* ========================================
   Weekend Styling and Weekday Name Formatting
   ======================================== */

/* Format weekday names as full words */
.cal-head__day {
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  /* text-transform: uppercase !important; */
  color: var(--calendar-primary) !important;
  /* padding: 0.75rem 0.5rem !important; */
}

/* Color weekend date numbers with accent color */
/* Sunday (first column) */
.cal-body__week .cal-body__day:first-child .cal-month-day,
.cal-body__week .cal-body__day:first-child .cal-day-number,
.cal-body__week .cal-body__day:first-child {
  color: var(--scholarion-accent, #f97316) !important;
}

/* Saturday (last column) */
.cal-body__week .cal-body__day:last-child .cal-month-day,
.cal-body__week .cal-body__day:last-child .cal-day-number,
.cal-body__week .cal-body__day:last-child {
  color: var(--scholarion-accent, #f97316) !important;
}

/* Ensure date numbers inherit the weekend color */
.cal-body__week .cal-body__day:first-child .cal-day-number,
.cal-body__week .cal-body__day:last-child .cal-day-number {
  font-weight: 500 !important;
}

/* Style the day number text specifically */
.cal-month-day .cal-day-number,
.cal-body__day .cal-day-number {
  display: block !important;
  padding: 0.5rem !important;
}

/* Dark mode support for weekend colors */
@media (prefers-color-scheme: dark) {
  .cal-body__week .cal-body__day:first-child,
  .cal-body__week .cal-body__day:last-child {
    color: var(--scholarion-accent, #fb923c) !important;
  }

  .cal-head__day {
    color: #f1f5f9 !important;
  }
}
/* ========================================
   Weekend Styling - High Specificity Override
   ======================================== */

/* Sunday (first column) - Maximum specificity */
#calendar .cal-body__week .cal-body__day:first-child .cal-month-day,
#calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:first-child span,
#calendar .cal-body__week .cal-body__day:first-child p,
.calendar .cal-body__week .cal-body__day:first-child .cal-month-day,
.calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:first-child span,
.calendar .cal-body__week .cal-body__day:first-child p,
div#calendar .cal-body__week .cal-body__day:first-child,
div.calendar .cal-body__week .cal-body__day:first-child {
  color: var(--scholarion-accent, #f97316) !important;
}

/* Saturday (last column) - Maximum specificity */
#calendar .cal-body__week .cal-body__day:last-child .cal-month-day,
#calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:last-child span,
#calendar .cal-body__week .cal-body__day:last-child p,
.calendar .cal-body__week .cal-body__day:last-child .cal-month-day,
.calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:last-child span,
.calendar .cal-body__week .cal-body__day:last-child p,
div#calendar .cal-body__week .cal-body__day:last-child,
div.calendar .cal-body__week .cal-body__day:last-child {
  color: var(--scholarion-accent, #f97316) !important;
}

/* Target all child elements within weekend cells */
#calendar .cal-body__week .cal-body__day:first-child *,
#calendar .cal-body__week .cal-body__day:last-child *,
.calendar .cal-body__week .cal-body__day:first-child *,
.calendar .cal-body__week .cal-body__day:last-child * {
  color: var(--scholarion-accent, #f97316) !important;
}

/* Ensure font weight for weekend numbers */
#calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:last-child .cal-day-number {
  font-weight: 500 !important;
  color: var(--scholarion-accent, #f97316) !important;
}

/* ============================================
   9. OOB ENTITY LIST CALENDAR
   ============================================ */
/* Entity List Calendar Override Styles */
/* Target Entity List calendar with higher specificity */
/* Year View Event List Styling */
/* ========================================
   OOB Entity List Calendar Styles
   ======================================== */

/* Year View Event List Styling */

/* Event list container */
#cal-slide-content.cal-event-list {
  padding: 1rem;
  background: var(--scholarion-bg, #ffffff);
}

#cal-slide-content.cal-event-list .list-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Individual event items */
#cal-slide-content .list-group-item.event-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-left: 4px solid var(--scholarion-primary, #0ea5e9);
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: default;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#cal-slide-content .list-group-item.event-item:hover {
  background: #ffffff;
  border-left-color: var(--scholarion-primary, #0ea5e9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Event heading */
#cal-slide-content .list-group-item-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin: 0;
  width: 100%;
  font-size: 1rem;
  font-weight: 500;
  color: #1e293b;
}

/* Icon badge styling */
#cal-slide-content .list-group-item-heading .label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 8px;
  background: #e0f2fe;
  font-size: 1.125rem;
}

/* Event content wrapper */
#cal-slide-content .list-group-item-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

/* Date and time styling */
#cal-slide-content .list-group-item-heading small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: #64748b;
  white-space: nowrap;
}

#cal-slide-content .list-group-item-heading small::before {
  content: "\f017";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Different event type colors */
#cal-slide-content .event-item[data-event-class="event-info"] .label {
  background: #e0f2fe;
}

#cal-slide-content .event-item[data-event-class="event-info"] .label .fa-solid {
  color: var(--calendar-primary);
}

#cal-slide-content .event-item[data-event-class="event-success"] .label {
  background: #d1fae5;
}

#cal-slide-content .event-item[data-event-class="event-success"] .label .fa-solid {
  color: #059669;
}

#cal-slide-content .event-item[data-event-class="event-warning"] .label {
  background: #fef3c7;
}

#cal-slide-content .event-item[data-event-class="event-warning"] .label .fa-solid {
  color: #d97706;
}

#cal-slide-content .event-item[data-event-class="event-danger"] .label {
  background: #fee2e2;
}

#cal-slide-content .event-item[data-event-class="event-danger"] .label .fa-solid {
  color: #dc2626;
}

/* === Calendar Header Layout === */
.page-header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
}

.calendar-navs,
.calendar-title-container,
.calendar-views {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-navs {
  flex: 0 0 auto;
  justify-content: flex-start;
}

.calendar-title-container {
  flex: 1 1 auto;
  justify-content: center;
}

.calendar-title-container .calendar-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
}

.calendar-views {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* Ensure button groups stay inline */
.calendar-navs .btn-group,
.calendar-views .btn-group {
  display: inline-flex;
  margin-right: 0.5rem;
}

.calendar-views .btn-group:last-child {
  margin-right: 0;
}

/* Button styling for consistency */
.calendar-navs .btn,
.calendar-views .btn {
  white-space: nowrap;
}

/* Responsive adjustments for header */
@media (max-width: 768px) {
  .page-header .row {
    flex-wrap: wrap;
  }

  .calendar-navs {
    order: 1;
    flex: 0 0 auto;
  }

  .calendar-title-container {
    order: 2;
    flex: 1 1 100%;
    justify-content: center;
    margin: 0.5rem 0;
  }

  .calendar-views {
    order: 3;
    flex: 0 0 auto;
  }
}

.page-header .calendar-views .btn-default.active,
.page-header .calendar-navs .btn-default.active {
  color: #ffffff !important;
  background-color: var(--scholarion-primary) !important;
  border-color: var(--scholarion-primary) !important;
}

.cal-day-today {
  font-weight: 800;
  color: var(--calendar-primary) !important;
  border: 2px solid var(--calendar-accent) !important;
  background: color-mix(in oklab, var(--calendar-accent) 12%, white) !important;
}

/* ========================================
   10. YEAR VIEW LAYOUT
   ======================================== */

/* === Year View Container === */
.cal-year-box {
  padding: 1rem;
  background: var(--scholarion-bg, #ffffff);
}

/* === Year View Rows === */
.cal-year-box .row.row-fluid.cal-before-eventlist {
  margin-bottom: 1rem !important;
  display: flex !important;
  gap: 1rem !important;
}

/* === Month Cells === */
.cal-year-box .cal-cell.span3,
.cal-year-box .cal-cell.col-md-3 {
  flex: 1 !important;
  min-height: 100px !important;
  padding: 1.25rem !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  position: relative !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  margin: 0 !important;
}

.cal-year-box .cal-cell:hover {
  background: #f8fafc !important;
  border-color: var(--scholarion-primary, #0ea5e9) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-2px) !important;
}

/* === Month Names === */
.cal-year-box .cal-month-name {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  text-transform: lowercase !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  text-align: center !important;
}

.cal-year-box .cal-month-name::first-letter {
  text-transform: uppercase !important;
}

/* === Event Count Badges === */
.cal-year-box .badge.badge-important,
.cal-year-box .badge-important {
  position: absolute !important;
  top: 0.75rem !important;
  left: 0.75rem !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: #dc2626 !important;
  color: #ffffff !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0 !important;
  float: none !important;
}

.cal-year-box .cal-events-num {
  float: none !important;
}

.cal-year-box .float-end,
.cal-year-box .float-start {
  float: none !important;
}

.cal-year-box .events-list.d-none {
  display: none !important;
}

/* Responsive - 2 columns on tablets, 1 column on mobile */
@media (max-width: 992px) {
  .cal-year-box .row.row-fluid.cal-before-eventlist {
    flex-wrap: wrap !important;
  }

  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    flex: 0 0 calc(50% - 0.5rem) !important;
    max-width: calc(50% - 0.5rem) !important;
  }
}

@media (max-width: 576px) {
  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    background: #1e293b !important;
    border-color: #334155 !important;
  }

  .cal-year-box .cal-cell:hover {
    background: #334155 !important;
  }

  .cal-year-box .cal-month-name {
    color: #f1f5f9 !important;
  }
}

#cal-slide-content .card-body,
#cal-slide-content.list-group-item {
  background: unset !important;
}

.cal-year-box .row {
  border-bottom: unset !important;
}

span[data-cal-date] {
  font-family: Arial;
  font-weight: 400;
  font-size: 20px;
  color: #000000;
}

.cal-day-weekend span[data-cal-date] {
  color: var(--calendar-accent) !important;
}

/* ============================================
   11. WEEKEND & WEEKDAY STYLING
   ============================================ */

/* === Weekday Names === */
.cal-head__day {
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  text-transform: capitalize !important;
  color: #1e293b !important;
  /* padding: 0.75rem 0.5rem !important; */
}

/* === Weekend Date Numbers (Sunday & Saturday) === */
/* High specificity to override portalbasic.css */
#calendar .cal-body__week .cal-body__day:first-child .cal-month-day,
#calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:first-child span,
#calendar .cal-body__week .cal-body__day:first-child p,
.calendar .cal-body__week .cal-body__day:first-child .cal-month-day,
.calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:first-child span,
.calendar .cal-body__week .cal-body__day:first-child p,
div#calendar .cal-body__week .cal-body__day:first-child,
div.calendar .cal-body__week .cal-body__day:first-child {
  color: var(--scholarion-accent, #f97316) !important;
}

#calendar .cal-body__week .cal-body__day:last-child .cal-month-day,
#calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:last-child span,
#calendar .cal-body__week .cal-body__day:last-child p,
.calendar .cal-body__week .cal-body__day:last-child .cal-month-day,
.calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:last-child span,
.calendar .cal-body__week .cal-body__day:last-child p,
div#calendar .cal-body__week .cal-body__day:last-child,
div.calendar .cal-body__week .cal-body__day:last-child {
  color: var(--scholarion-accent, #f97316) !important;
}

#calendar .cal-body__week .cal-body__day:first-child *,
#calendar .cal-body__week .cal-body__day:last-child *,
.calendar .cal-body__week .cal-body__day:first-child *,
.calendar .cal-body__week .cal-body__day:last-child * {
  color: var(--scholarion-accent, #f97316) !important;
}

#calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
#calendar .cal-body__week .cal-body__day:last-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:first-child .cal-day-number,
.calendar .cal-body__week .cal-body__day:last-child .cal-day-number {
  font-weight: 500 !important;
  color: var(--scholarion-accent, #f97316) !important;
}

/* ============================================
   12. CALENDAR SPACING ADJUSTMENTS
   ============================================ */

/* === Remove Gaps Between Days === */
/* Consolidated spacing rules for tighter calendar layout */
.cal-body__day,
.cal-month-day {
  margin: 0 !important;
}

#calendar .cal-body__week,
.calendar__body .cal-body__week {
  gap: 0 !important;
  column-gap: 0 !important;
  row-gap: 0 !important;
  padding: 0 !important;
}

.calendar__body {
  gap: 0 !important;
  grid-gap: 0 !important;
}

.cal-body__day,
.cal-month-day {
  width: 100% !important;
  flex: 1 1 0% !important;
  border-radius: 0 !important;
}

/* ============================================
   13. THEME VARIATIONS
   ============================================ */

/* === DARK MODE === */
html[data-theme="dark"] {
  --calendar-surface: #586574;
  --calendar-bg: #586574;
  --calendar-border: #1f2937;
  --calendar-text: #e5e7eb;
  --calendar-text-muted: #9aa4b2;
  --calendar-primary: #013530;
  --calendar-secondary: #94a3b8;
  --calendar-accent: #34d399;
}

/* Dark Mode - Badges */
html[data-theme="dark"] .badge-present {
  background-color: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.3);
}

html[data-theme="dark"] .badge-present::before {
  color: #10b981;
}

html[data-theme="dark"] .badge-absent {
  background-color: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.3);
}

html[data-theme="dark"] .badge-absent::before {
  color: #ef4444;
}

html[data-theme="dark"] .badge-late,
html[data-theme="dark"] .badge-tardy {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.3);
}

html[data-theme="dark"] .badge-late::before,
html[data-theme="dark"] .badge-tardy::before {
  color: #fbbf24;
}

html[data-theme="dark"] .badge-excused {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.3);
}

html[data-theme="dark"] .badge-excused::before {
  color: #60a5fa;
}

html[data-theme="dark"] .badge-unexcused {
  background-color: rgba(173, 20, 87, 0.2);
  color: #f06292;
  border-color: rgba(240, 98, 146, 0.3);
}

html[data-theme="dark"] .badge-unexcused::before {
  color: #f06292;
}

/* Dark Mode - Data Cells */
html[data-theme="dark"] .dataCell,
html[data-theme="dark"] .moreDataCell {
  background-color: var(--calendar-fg);
  color: var(--calendar-text);
  border-color: color-mix(in oklab, var(--calendar-fg) 70%, var(--calendar-border) 30%);
}

html[data-theme="dark"] .dataCell::before,
html[data-theme="dark"] .moreDataCell::before {
  color: var(--calendar-secondary);
}

/* Dark Mode - OOB Event List */
@media (prefers-color-scheme: dark) {
  #cal-slide-content .list-group-item.event-item {
    background: #1e293b !important;
    border-color: #334155 !important;
  }

  #cal-slide-content .list-group-item-heading {
    color: #f1f5f9;
  }

  #cal-slide-content .list-group-item-heading small {
    color: #94a3b8;
  }

  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    background: #1e293b !important;
    border-color: #334155 !important;
  }

  .cal-year-box .cal-cell:hover {
    background: #334155 !important;
  }

  .cal-year-box .cal-month-name {
    color: #f1f5f9 !important;
  }

  .cal-head__day {
    color: #f1f5f9 !important;
  }
}

/* === HIGH CONTRAST MODE === */
html[data-theme="high-contrast"] {
  --calendar-primary: #004c45;
  --calendar-secondary: #2d8a8a;
  --calendar-accent: #d97706;
  --calendar-success: #008000;
  --calendar-warning: #ff6600;
  --calendar-danger: #cc0000;
  --calendar-info: #cc9900;
  --calendar-info-light: #ffffcc;
  --calendar-surface: #ffffff;
  --calendar-bg: #ffffff;
  --calendar-border: #000000;
  --calendar-text: #000000;
  --calendar-text-muted: #333333;
  --calendar-fg: #cce5ff;
  --calendar-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --calendar-shadow-md: 0px 2px 6px rgba(0, 0, 0, 0.4), 0px 1px 2px rgba(0, 0, 0, 0.3);
}

/* High Contrast - Badges */
html[data-theme="high-contrast"] .badge-present,
html[data-theme="high-contrast"] .badge-absent,
html[data-theme="high-contrast"] .badge-late,
html[data-theme="high-contrast"] .badge-tardy,
html[data-theme="high-contrast"] .badge-excused,
html[data-theme="high-contrast"] .badge-unexcused {
  border-width: 2px;
  font-weight: 700;
  box-shadow: var(--calendar-shadow-md);
}

html[data-theme="high-contrast"] .badge-present {
  background-color: #006600;
  color: #ffffff;
  border-color: #000000;
}

html[data-theme="high-contrast"] .badge-present::before {
  color: #ffffff;
}

html[data-theme="high-contrast"] .badge-absent {
  background-color: #cc0000;
  color: #ffffff;
  border-color: #000000;
}

html[data-theme="high-contrast"] .badge-absent::before {
  color: #ffffff;
}

html[data-theme="high-contrast"] .badge-late,
html[data-theme="high-contrast"] .badge-tardy {
  background-color: #ff6600;
  color: #000000;
  border-color: #000000;
}

html[data-theme="high-contrast"] .badge-late::before,
html[data-theme="high-contrast"] .badge-tardy::before {
  color: #000000;
}

html[data-theme="high-contrast"] .badge-excused {
  background-color: #0066cc;
  color: #ffffff;
  border-color: #000000;
}

html[data-theme="high-contrast"] .badge-excused::before {
  color: #ffffff;
}

html[data-theme="high-contrast"] .badge-unexcused {
  background-color: #990000;
  color: #ffffff;
  border-color: #000000;
}

html[data-theme="high-contrast"] .badge-unexcused::before {
  color: #ffffff;
}

/* ============================================
   14. RESPONSIVE DESIGN
   ============================================ */

/* === TABLET (max-width: 992px) === */
@media (max-width: 992px) {
  .cal-year-box .row.row-fluid.cal-before-eventlist {
    flex-wrap: wrap !important;
  }

  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    flex: 0 0 calc(50% - 0.5rem) !important;
    max-width: calc(50% - 0.5rem) !important;
  }

  .page-header .row {
    flex-wrap: wrap;
  }

  .calendar-navs {
    order: 1;
    flex: 0 0 auto;
  }

  .calendar-title-container {
    order: 2;
    flex: 1 1 100%;
    justify-content: center;
    margin: 0.5rem 0;
  }

  .calendar-views {
    order: 3;
    flex: 0 0 auto;
  }
}

/* === MOBILE (max-width: 768px) === */
@media (max-width: 768px) {
  #cal-slide-content .list-group-item-heading {
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
  }

  #cal-slide-content .list-group-item-heading small {
    grid-column: 2;
    margin-top: 0.25rem;
  }

  .dataCell,
  .moreDataCell {
    display: none;
  }

  .mobileEvents {
    display: block;
    border-radius: var(--radius-full);
    height: 2rem;
    width: 2rem;
    background-color: #605e5c;
  }

  #mobileEventDiv {
    display: block;
    color: var(--calendar-text);
  }

  .badge-present,
  .badge-absent,
  .badge-late,
  .badge-tardy,
  .badge-excused,
  .badge-unexcused {
    padding: 0.375rem;
    min-width: 2rem;
    min-height: 2rem;
    justify-content: center;
    font-size: 0;
  }

  .badge-present::before,
  .badge-absent::before,
  .badge-late::before,
  .badge-tardy::before,
  .badge-excused::before,
  .badge-unexcused::before {
    font-size: 1rem;
    margin: 0;
  }

  .badge-present::after,
  .badge-absent::after,
  .badge-late::after,
  .badge-tardy::after,
  .badge-excused::after,
  .badge-unexcused::after {
    display: none;
  }

  #attendanceViewCalendarControl,
  #calendarControl {
    padding: var(--spacing-xs);
  }
}

/* === SMALL MOBILE (max-width: 576px) === */
@media (max-width: 576px) {
  .cal-year-box .cal-cell.span3,
  .cal-year-box .cal-cell.col-md-3 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* ============================================
   15. ACCESSIBILITY
   ============================================ */

/* === Focus States === */
.badge-present:focus,
.badge-absent:focus,
.badge-late:focus,
.badge-tardy:focus,
.badge-excused:focus,
.badge-unexcused:focus {
  outline: 2px solid var(--calendar-accent);
  outline-offset: 2px;
}

html[data-theme="high-contrast"] .badge-present:focus,
html[data-theme="high-contrast"] .badge-absent:focus,
html[data-theme="high-contrast"] .badge-late:focus,
html[data-theme="high-contrast"] .badge-tardy:focus,
html[data-theme="high-contrast"] .badge-excused:focus,
html[data-theme="high-contrast"] .badge-unexcused:focus,
html[data-theme="high-contrast"] .cal-body__day:focus {
  outline-width: 3px;
  outline-offset: 3px;
  outline-color: var(--calendar-primary);
}

/* ============================================
   16. PRINT STYLES
   ============================================ */
@media print {
  .badge-present,
  .badge-absent,
  .badge-late,
  .badge-tardy,
  .badge-excused,
  .badge-unexcused,
  .dataCell,
  .moreDataCell {
    box-shadow: none;
    border: 1px solid currentColor;
  }
}

